Repository navigation
fix(markdown): 本地链接里的 Windows 反斜杠统一为正斜杠 - #1055
Merged
Merged
Conversation
Markdown 把 `\_` 当作转义,`[x](C:\ws\_analysis\r.md)` 解析后路径少一个分隔符(变成 `C:\ws_analysis\r.md`),点击时报 ENOENT(issue omdsh-dev#1037)。 - rewriteDestination 对所有本地 destination 的路径部分用正斜杠输出(Windows 接受两种写法);无 fragment / line fragment / heading fragment 三条分支都覆盖 - UNC 前缀保持 `\\`,避免被解析成协议相对的 `//host/share` - 新增 6 条断言:绝对/相对 Windows 路径、heading/line fragment、远程链接、幂等 验证:tsc --noEmit 与 eslint 通过;同一组用例用 Node 直跑通过(本机 vitest 配置打包在 Windows 上失败,CI 执行该 spec)。
davidLi17
added a commit
to davidLi17/DSH-better-sidebar
that referenced
this pull request
Oct 25, 2026
Selectively backport open upstream PRs omdsh-dev#1040 (598714b), omdsh-dev#1055 (828452a), and omdsh-dev#1053 (f2ad4b1). Isolate Mermaid layout with authenticated sandbox messaging, recover from malformed diagrams, cancel/promote queued renders, preserve Windows Markdown separators and keep the bottom workbench toggle reachable. Preserve LHG draft/image sidechat behavior and selective omdsh-dev#1050 performance fixes. Ship prebuilt lib without lifecycle hooks. Validation: 230 files, 2790 tests passed, 17 skipped; typecheck, lint, build, consumer types, pack and fresh official DSH rc1 install/start passed. Real browser UI and native Windows unverified; see maintenance record.
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Windows 路径写进 Markdown 链接时,分隔符会被吃掉:
点开后报
ENOENT,因为 Markdown 把\_当作转义,实际打开的路径变成了C:\ws_analysis\report.md——少了一个分隔符。\.、\*、\[等同样中招。容易误判的地方:链接的 href 会把反斜杠规范成
/,所以只有「反斜杠 + ASCII 标点」那一处会丢,其余分隔符看起来正常,路径“像是对的”。关联 issue: #1037
修复
在渲染前归一化,而不是在打开失败后猜路径:
rewriteDestination()对所有本地 destination 的路径部分输出正斜杠(Windows 文件系统两种写法都接受);#L24)、heading fragment(%23标题);\\,避免被解析成协议相对的//host/share;https://、mailto:)原样返回,不做任何改动;改动文件:
src/client/markdown-navigation.tstests/markdown-navigation.spec.tsCHANGELOG.md测试
新增 6 条断言:
%23;\\;验证
tsc --noEmit:通过eslint:通过Cannot convert undefined or null to object,空配置同样失败,与本次改动无关),因此本地用 Node 直接跑同一组用例通过;CI 会执行该 spec。风险